Untitled

Kyle Rozic

4/21/2021

Packages required

library(plotly)

Boston Housing Data

Data from Kaggle

Load Data

bostonhousing <- read.csv('./data/housing.csv', header = F, sep = '')
colnames(bostonhousing) <- c('CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT', 'MEDV')
head(bostonhousing)
##      CRIM ZN INDUS CHAS   NOX    RM  AGE    DIS RAD TAX PTRATIO      B LSTAT
## 1 0.00632 18  2.31    0 0.538 6.575 65.2 4.0900   1 296    15.3 396.90  4.98
## 2 0.02731  0  7.07    0 0.469 6.421 78.9 4.9671   2 242    17.8 396.90  9.14
## 3 0.02729  0  7.07    0 0.469 7.185 61.1 4.9671   2 242    17.8 392.83  4.03
## 4 0.03237  0  2.18    0 0.458 6.998 45.8 6.0622   3 222    18.7 394.63  2.94
## 5 0.06905  0  2.18    0 0.458 7.147 54.2 6.0622   3 222    18.7 396.90  5.33
## 6 0.02985  0  2.18    0 0.458 6.430 58.7 6.0622   3 222    18.7 394.12  5.21
##   MEDV
## 1 24.0
## 2 21.6
## 3 34.7
## 4 33.4
## 5 36.2
## 6 28.7

Correlate Housing Data to House Price

plot_ly(bostonhousing, 
        x = bostonhousing$CRIM, 
        y = bostonhousing$MEDV, 
        z = bostonhousing$RM, 
        type = 'scatter3d', 
        mode = 'markers', 
        alpha = 0.5, 
        color = bostonhousing$RAD, 
        size = bostonhousing$TAX)
## Warning: `line.width` does not currently support multiple values.

Conclusion

This was mainly an experiment to visualize many variables in 1 plot. It starts to get pretty confusing when this many variables are in the plot but it may be useful depending on the data. With this data I can see that a high accessibility to radial highways (RAD, yellow) correlates well with per capita crime rate (CRIM, x).

Have A Great Day Stranger!